from pyzbar import pyzbar
def get_barcode_data(file):
    text = ""
    barcode_val = pyzbar.decode(file)
    if barcode_val:
        barcode = barcode_val[0]
        data = barcode.data.decode("utf-8")
        text = "{}".format(data)
    return text

